1. Field of the Invention
The present invention relates to an encoding apparatus for compressing and outputting image data.
2. Related Background Art
A system for differential vector or quantization, DPCM, or the like is known as a system for quantizing a differential signal and performing a code assignment to a signal series such as an image signal having a high correlation. The difference between the DPCM and the differential vector quantization relates to the signal to be processed; namely, a one dimensional signal is processed in the DPCM system and a multi-dimensional signal is processed in the differential vector quantization system. Their essential points are the same. Therefore, the DPCM is, considered to be a kind of differential vector quantization for one dimensional signals.
The DPCM system is well known as a system for compressing and transmitting the digitized image data. According to this system, a differential signal which is obtained by subtracting a prediction signal from the input signal is quantized and encoded by assigning a variable length code or the like and thereafter, the encoded signals are transmitted.
It is a general way to use a preliminary pixel value as a prediction value. However, there has been proposed a method whereby the preliminary pixel value is not used as the prediction value, but instead a two-dimensional prediction is performed on the basis of the pixel values which have already been quantized, or a prediction is executed using a predicting function of a high order of one or more degrees, thereby quantizing the predicted error, i.e., the difference. For example, since the image signal has a high two-dimensional correlation, there have been proposed various kinds of two-dimensional predicting methods whereby in the case where, for example, as shown in FIG. 1, pixels C, E, and D are arranged in that order in sequence in the horizontal direction and pixels X.sub.i-1 and x.sub.i are arranged under those pixels, the following signals are used as prediction signals x.sub.i ' for encoding the pixel x.sub.i : EQU x.sub.i '=x.sub.i-1 +(E-C)/2 (1) EQU x.sub.i '=(x.sub.i-1 +D)/2 (2) EQU x.sub.i '=x.sub.i-1 +E-C (3) EQU x.sub.i '=x.sub.i-1 +(E-D)/2 (4)
FIG. 2 shows distributions of the predicted errors, namely, the differences with the predicted values in the cases where the preliminary pixel value is used as a predicted value and where the two-dimensional prediction is performed. Since the predicted error caused by the two-dimensional prediction is smaller as a whole, the average word length can be reduced by assigning short codes to many pixels.
According to the conventional DPCM system using the two-dimensional prediction, in general, the predicted error is quantized by a linear quantization characteristic as shown in (1) in FIG. 3, and the variable-length codes are assigned using the representative value, as a central value, when the predicted error is zero as shown in (2) in FIG. 3.
In FIG. 3, an axis of abscissa denotes a predicted error and an axis of ordinate represents a quantization representative value. The symbols &lt;&gt; are used to represent the quantized value.
As numbers of quantization representative values, the numbers are symmetrically written with respect to the positive and negative values as shown in FIG. 3 by use of the quantization representative value=0 as a central value. The symbols [] are used to represent the number of quantization representative value.
When attention is paid to the relative relation between the two-dimensional prediction value and the preliminary pixel, the predicted error distribution in the preliminary value prediction has a characteristic distribution. This point will be practically explained with reference to the drawings. In FIG. 2, since x.sub.i-1 is the value which has already been quantized, it is set to &lt;x.sub.i-1 &gt;. With respect to the differential value x.sub.i -&lt;x.sub.i-1 &gt; and the two-dimensional prediction value x.sub.i ', the quantization representative value, numbers which are obtained when x.sub.1 '-&lt;x.sub.i-l &gt; has been linearly quantized are set to [x.sub.i -&lt;x.sub.i-1 &gt;] and [x.sub.i '-&lt;x.sub.i-l &gt;], respectively. The frequency distributions of [x.sub.i -&lt;x.sub.i-1 &gt;] when [x.sub.i '-&lt;x.sub.i-l &gt;] is equal to 0, 2, 5, and 10 are as shown in (1), (2), (3), and (4) in FIG. 4, respectively. In this case, the two-dimensional prediction system based on the equation (2) is used.
In FIG. 4, when [x.sub.i '-&lt;x.sub.i-l &gt;]=0 in (1), [x.sub.i -&lt;x.sub.i-1 &gt;] has the distribution which is extremely concentrated to zero and is symmetrical in the right and left directions with respect to the representative value of 0. When [x.sub.i '-&lt;x.sub.i-l &gt;]=2 in (2), [x.sub.i -&lt;x.sub.i-l &gt;] has the distribution which has the peak value of 2 but is not symmetrical with respect to the representative value of 2 and is one-sided toward the representative value of 0. When [x.sub.i '-&lt;x.sub.i-l &gt;]=5 in (3), [x.sub.i -&lt;x.sub.i-1 &gt;] has the distribution which does not have the peak at the representative value of 5 and is one-sided toward the representative value of 0. When [x.sub.i '-&lt;x.sub.i-l &gt;]=10 in (4), the distribution is fairly dispersed and has the peak at zero. In the foregoing examples, cases where [x.sub.i '-&lt;x.sub.i-l &gt;] is zero or more have been shown as the examples. However, in the cases of the negative values, the distributions which are obtained by reversing the positive values in the distributions in FIG. 4 into the negative values are provided.
As will be obvious from the above explanation, [x.sub.i -&lt;x.sub.i &gt;] does not always present the symmetrical distribution having the peak at the value of [x.sub.i '-&lt;x.sub.i &gt;] but provides the characteristic unique distribution in dependence on the value of [x.sub.i '-&lt;x.sub.i &gt;], in other words, the relative relation between x.sub.i ' and &lt;x.sub.i-1 &gt;.
Obviously, the fact shown in FIG. 4 is not contradictory with the conventional fact. Namely, when the correlations between x.sub.i and x.sub.i ' are examined with regard to all of the values of [x.sub.i '-&lt;x.sub.i-l &gt;], the frequency distribution which has the peak at x.sub.i -x.sub.i '=0 and is symmetrical with respect to the positive and negative values is derived as shown in (2) in FIG. 2.
The conventional code assignment will now be studied on the basis of the foregoing fact. When codes have been assigned on the basis of the distribution (2) in FIG. 2, the code length assignments to the distributions in FIG. 4 are performed on the basis of the value of [x.sub.i '-&lt;x.sub.i &gt;] as a central value as shown in FIG. 5.
When considering the distribution of [x.sub.i -&lt;x.sub.i-l &gt;], this code length assignment is improper.
On the other hand, as a visual characteristic of a human being, there is known what is called a masking phenomenon such that in the portion where an image changes greatly, even if a slight error occurs in the image, this error is hardly sensed by the naked eye. For example, this masking phenomenon occurs in the contour portion where an image in a still image or animation image spatially changes or in the portion where an animation image changes with the lapse of time. In the conventional DPCM system, a method whereby the difference with the preliminary value prediction value is non-linearly quantized by use of the masking phenomenon as shown in FIG. 6 is known. Namely, since the image greatly changes in the area having a large difference value, a wide quantization range can be provided for the representative value.
However, according to the conventional DPCM system by the two-dimensional prediction, the non-linear quantization characteristic in consideration of the foregoing visual characteristic cannot be properly set. Therefore, the linear quantization is merely performed or the non-linear quantization is merely executed irrespective of the visual characteristic. In the DPCM of the two-dimensional prediction by the conventional linear quantization, a large compression factor cannot be expected. In addition, the execution of the non-linear quantization which does not consider the visual characteristic results in a deterioration in image quality.